package com.dlut.java2;

import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;

/**
 * @Author: LiuHeng
 * @Description:
 * @Date: 2022-09-06 19:00
 */
public class T0906_ManHelp {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = in.nextInt();
        }
        Arrays.sort(arr);
        map = new HashMap<>();
        int ans = dfs(arr, 0);
        System.out.println(ans);
    }

    /**
     * 组队
     */
    static HashMap<Integer,Integer> map = new HashMap<>();
    static int dfs(int[] arr, int index){
        int n = arr.length;
        if (index >= n)
            return 0;
        if (index == n-1){
            return 1;
        }
        if (map.containsKey(index)){
            return map.get(index);
        }

        int c1 =n, c2 = n, c3 = n;
        c1 = 1 + dfs(arr,index+1);
        if (index < n-1 && arr[index+1] - arr[index] <= 20){
            c2 = 1 + dfs(arr, index + 2);
        }
        if (index < n-2 && arr[index+2] - arr[index] <= 10){
            c3 = 1+ dfs(arr, index + 3);
        }
        int ans = Math.min(c1, Math.min(c2, c3));
        map.put(index, ans);
        return ans;
    }


/*
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.nextLine();
        if (s.charAt(0) != '1'){
            System.out.println(-1);
            return;
        }
        int count = 0;
        for (int i = 1; i < s.length(); i++) {
            if (s.charAt(i) == '3'){
                count++;
            }else {
                System.out.println(-1);
                return;
            }
        }
        if (count >0)
            System.out.println(count);
        else
            System.out.println(-1);
    }*/
}
